unsigned long page_array[3];
shared_iopage_t *sp;
void *ioreq_buffer_page;
- unsigned long dom_memsize = (memsize << 20);
+ // memsize = required memsize(in configure file) + 16M
+ // dom_memsize will pass to xc_ia64_build_hob(), so must be subbed 16M
+ unsigned long dom_memsize = ((memsize - 16) << 20);
+ unsigned long nr_pages = (unsigned long)memsize << (20 - PAGE_SHIFT);
+ int rc;
DECLARE_DOMCTL;
+ // ROM size for guest firmware, ioreq page and xenstore page
+ nr_pages += 3;
+
if ((image_size > 12 * MEM_M) || (image_size & (PAGE_SIZE - 1))) {
PERROR("Guest firmware size is incorrect [%ld]?", image_size);
return -1;
}
+ rc = xc_domain_memory_increase_reservation(xc_handle, dom, nr_pages,
+ 0, 0, NULL);
+ if (rc != 0) {
+ PERROR("Could not allocate memory for HVM guest.\n");
+ goto error_out;
+ }
+
/* This will creates the physmap. */
domctl.u.arch_setup.flags = XEN_DOMAINSETUP_hvm_guest;
domctl.u.arch_setup.bp = 0;